package cn.learn.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 测试一下用户的权限
 *
 * @author huangyezhan
 * @date 2020年02月15日16:22
 */
@RestController
public class OderDemoController {

    /**
     * 数据库权限列表没存
     *
     * @return
     */
    @RequestMapping(value = "placeOrder", method = RequestMethod.GET)
    public Map placeOrder() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("订单状态", "成功");
        return map;
    }

    /**
     * 数据库权限列表没存
     *
     * @return
     */
    @RequestMapping(value = "cancelOrder", method = RequestMethod.GET)
    public Map cancelOrder() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("撤销订单状态", "失败");
        return map;
    }


//==================================================================================

    /**
     * 在数据库
     *
     * @return
     */
    @RequestMapping(value = "deleteOrder", method = RequestMethod.GET)
    public Map deleteOrder() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("删除订单状态", "请联系管理员!");
        return map;
    }

    /**
     * 在数据库,用户没有权限
     *
     * @return
     */
    @RequestMapping(value = "testOrder", method = RequestMethod.GET)
    public Map testOrder() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("测试订单", "测试订单_成功");
        return map;
    }


}
